package de.zainodis.triplog.ui.task;

import android.content.Context;
import android.os.AsyncTask;

import de.zainodis.triplog.data.TripEntry;

/**
 * Created by fzarrai on 10/4/2014.
 */
public class CurrentTripLoader extends AsyncTask<Boolean, Void, TripEntry> {

    private Context context;
    private IAsyncTaskParent<TripEntry> parent;

    public CurrentTripLoader(Context context, IAsyncTaskParent<TripEntry> parent) {
        super();
        this.context = context;
        this.parent = parent;
    }

    @Override
    protected TripEntry doInBackground(Boolean... params) {
        return TripEntry.queryForOpen(context, params[0]);
}

    @Override
    protected void onPostExecute(TripEntry tripEntry) {
        super.onPostExecute(tripEntry);
        parent.onPostExecute(tripEntry);
    }
}
